<template>
	<view class="wisdom-box">
		<view class="grid-box">
			<view v-for="(gridItem,gridIndex) in gridList" :key="gridIndex" class="grid-item" @click="openSkip(gridIndex)">
				<u-icon :name="gridItem.icon" :size="70"></u-icon>
				<view class="grid-text mt-10">{{gridItem.text}}</view>
			</view>
		</view>

		<view class="vehicle-manage">
			<u-section :show-line="false" title="车辆管理" color="#fff" sub-color="#fff" line-color="#fff" sub-title="详情"
				@click="openSkip(0)" />
			<view class="stall">
				<view>
					<text class="stall-title">小区可用车位</text>
					<text class="stall-num">0</text>
				</view>
				<view>
					<text class="stall-title">我的车位</text>
					<text class="stall-num">无</text>
				</view>
			</view>
			<view class="add-vehicle">
				<u-icon name="plus-circle-fill" color="#fff" size="120" @click="openAddPlate"></u-icon>
				<view class="add-vehicle-text">
					<text>添加车辆</text>
					<text>畅享无感同行</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getLocalImg
	} from '@/utils/localFileUtil.js';
	export default {
		data() {
			return {
				gridList: [{
						text: "我的车辆",
						icon: getLocalImg('mj02.jpg')
					},
					{
						text: "门禁管理",
						icon: getLocalImg('mj01.jpg')
					},
					{
						text: "访客预约",
						icon: getLocalImg('mj03.jpg')
					}
				],
			}
		},
		methods: {
			openAddPlate() {
				uni.navigateTo({
					url: '/subPack/addPlate'
				})
			},
			openSkip(index) {
				switch (index) {
					case 0:
						uni.navigateTo({
							url: '/subPack/myCar'
						})
						break;
					case 1:
						uni.navigateTo({
							url: '/subPack/accessControl'
						})
						break;
					case 2:
						uni.navigateTo({
							url: '/subPack/guestList'
						})
						break;
					default:
						break;
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.wisdom-box {
		padding: 0 30rpx;
		background-color: $-color-white;
	}

	.grid-box {
		display: flex;
		justify-content: space-between;

		.grid-item {
			flex: 1;
			text-align: center;
			background-color: transparent;
			padding: 30rpx 10rpx;
			border-radius: 5%;
		}
	}

	.vehicle-manage {
		background-color: #c4e5ee;
		padding: 20rpx 30rpx;
		color: $-color-white;
		border-radius: 15rpx;
		margin-top: 30rpx;

		.stall {
			display: flex;
			border-bottom: 1px solid #fff;
			margin: 30rpx 0;

			>view {
				display: flex;
				flex-direction: column;
				align-items: flex-start;
				justify-content: space-between;
				margin-right: 20rpx;



				.stall-num {
					font-weight: 700;
					text-align: left;
					margin: 15rpx 0;
					font-size: 38rpx;
				}

			}
		}

		.add-vehicle {
			margin: 10rpx 0;
			display: flex;

			.add-vehicle-text {
				display: flex;
				flex-direction: column;
				align-items: flex-start;
				justify-content: space-around;
				margin-left: 20rpx;
				font-size: 24rpx
			}
		}
	}
</style>